package com.example.day08;

import java.io.File;
import java.io.IOException;
import java.sql.Date;
import java.sql.SQLOutput;
import java.util.Arrays;

public class FileTest {
    public static void main(String[] args) throws IOException {
        File file = new File("test.txt");
        System.out.println(file.canRead());
        System.out.println(file.canWrite());

        File newFile = new File("test-new.txt");
//        newFile.createNewFile();
//        newFile.deleteOnExit();

        System.out.println(file.getAbsoluteFile());
        System.out.println(file.getAbsolutePath());

        System.out.println(file.getName());
        System.out.println(file.getParent());

        System.out.println(file.getParentFile());
        System.out.println(file.getPath());

        System.out.println(file.getTotalSpace() / 1024 / 1024 / 1024);
        System.out.println(file.getUsableSpace() / 1024 / 1024 / 1024);

        System.out.println(file.isAbsolute());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());

        System.out.println(file.isHidden());
        System.out.println(new Date(file.lastModified()));

        System.out.println(file.length());

        System.out.println(Arrays.toString(file.list()));

//        File d2 = new File("d2/d22/d222");
//        d2.mkdirs();

        file.renameTo(new File("test-rename.txt"));

    }
}